1 module geany_d_binding.geany.document; 2 3 import geany_d_binding.geany.types; 4 import geany_d_binding.geany.filetypes; 5 import geany_d_binding.geany.editor: GeanyEditor; 6 7 import gtkc.gobjecttypes: GCallback; 8 import gtkc.gtktypes: GtkDialog, GtkWidget, GDestroyNotify; 9 import gtk.Version; 10 import glib.c.types: GModule; 11 12 extern(System) @nogc nothrow: 13 14 /** 15 * Structure for representing an open tab with all its properties. 16 **/ 17 struct GeanyDocument 18 { 19 /** Flag used to check if this document is valid when iterating @ref GeanyData::documents_array. */ 20 gboolean is_valid; 21 gint index; /**< Index in the documents array. */ 22 /** Whether this document supports source code symbols(tags) to show in the sidebar. */ 23 gboolean has_tags; 24 /** The UTF-8 encoded file name. 25 * Be careful; glibc and GLib file functions expect the locale representation of the 26 * file name which can be different from this. 27 * For conversion into locale encoding, you can use @ref utils_get_locale_from_utf8(). 28 * @see real_path. */ 29 gchar *file_name; 30 /** The encoding of the document, must be a valid string representation of an encoding, can 31 * be retrieved with @ref encodings_get_charset_from_index. */ 32 gchar *encoding; 33 /** Internally used flag to indicate whether the file of this document has a byte-order-mark. */ 34 gboolean has_bom; 35 GeanyEditor *editor; /**< The editor associated with the document. */ 36 /** The filetype for this document, it's only a reference to one of the elements of the global 37 * filetypes array. */ 38 GeanyFiletype *file_type; 39 /** TMSourceFile object for this document, or @c NULL. */ 40 TMSourceFile *tm_file; 41 /** Whether this document is read-only. */ 42 gboolean readonly; 43 /** Whether this document has been changed since it was last saved. */ 44 gboolean changed; 45 /** The link-dereferenced, locale-encoded file name. 46 * If non-NULL, this indicates the file once existed on disk (not just as an 47 * unsaved document with a filename set). 48 * 49 * @note This is only assigned after a successful save or open - it should 50 * not be set elsewhere. 51 * @see file_name. */ 52 gchar *real_path; 53 /** A pseudo-unique ID for this document. 54 * @c 0 is reserved as an unused value. 55 * @see document_find_by_id(). */ 56 guint id; 57 58 GeanyDocumentPrivate* priv; /* should be last, append fields before this item */ 59 } 60 61 struct GeanyDocumentPrivate; 62 63 /** 64 * Finds the current document. 65 * 66 * @return @transfer{none} @nullable A pointer to the current document or @c NULL if there are no opened documents. 67 **/ 68 GeanyDocument* document_get_current();